<?php
require_once './includes/common.php';
require_once './admin/admin.class.php';

$apiData = adminClass::getApi($DB, $_GET['ip']);

function checkServerSatatus($ip) {
	$str = null;
	$fp = @fsockopen($ip,80,$errno,$errstr,10);

	if (!$fp) {
		return false;
	}
	else {
		fclose($fp);
		return true;
	}
}
$server_ip_list = array(
	 $_GET['ip']
);
require_once './head.php';
$apiFrom=dzdz($_GET['ip']);
echo "<h1><center>您测试的IP为";
echo $_GET['ip'];
echo "<br />";
echo "IP归属：";
echo $apiFrom['location'];
echo "</h1></center>";
?>
            <main id="main-container">

                <div class="content">
                    <div class="block">
                        <div class="block-header">
                            <h3 class="block-title"><?=$title?></h3>
                        </div>
                        <div class="block-content">
                          	<?php
					foreach ($server_ip_list as $key => $val) {

						$i++;
						if (checkServerSatatus($server_ip_list[$key])) {
							echo "<h1><div class=\"online\"><center>恭喜您，此接口一切正常</center></div></h1>";
						} else {
							echo "<h1><div class=\"offline\"><center>接口异常，请联系站长</center></div></h1>";
						}
					}

				 ?>
                            </div>
                        </div>
                    </div>
                </div>
            </main>
        </div>
        <script src="//www.hfunnvv.cn/assets/js/oneui.core.min.js"></script>
        <script src="//www.hfunnvv.cn/assets/js/oneui.app.min.js"></script>
        <script src="//www.hfunnvv.cn/assets/vendor/layer/layer.js"></script>
    </body>
</html>
        <script src="//www.hfunnvv.cn/assets/js/oneui.core.min.js"></script>
        <script src="//www.hfunnvv.cn/assets/js/oneui.app.min.js"></script>
        <script src="//www.hfunnvv.cn/assets/vendor/layer/layer.js"></script>
    </body>
</html>